<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>新增角色</title>
</head>
  <body>
  <script type="text/javascript">
  		var winRoleAdd = new Windows("role_add");
  		var oRoleAdd = {
  			initForm : function(){
 				winRoleAdd.find('#roleForm').form({   
				    url:'$!basePath/admin/role/doAdd',   
				    onSubmit: function(){
				    	var pass = winRoleAdd.find('#roleForm').form("validate");
				    	if(pass){
				    		winRoleAdd.find("#ok").linkbutton("loading");
				    	}
				    	return pass; 
				    },   
				    success:function(data){
				   		var result = jQuery.parseJSON(data);   
				        if(result.success == true){
				        	top.Notiy.success("添加成功!");
			        		winRoleAdd.setReturnValue(true);
							winRoleAdd.close();
				        }else{
				        	top.Dialog.alert("提示",result.error,"error");
				        }
				        winRoleAdd.find("#ok").linkbutton("reset");
				    }
				}); 
	 		},
	 		ok : function(){
	 			winRoleAdd.find('#roleForm').submit();
	 		},
	 		cancel : function(){
	 			winRoleAdd.close();
	 		}
  		};
  		$(function(){
			oRoleAdd.initForm();
  		});
	</script>
    <div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<form id="roleForm" method="post" style="padding-top:10px;padding-left:20px;">
				<table width="90%">
					<tr>
						<td>名称：</td>
						<td>
						<input class="easyui-validatebox" type="text" name="name" maxlength="20" data-options="required:true,validType:'minLength[2]'" style="width: 90%;"/>  
						</td>
					</tr>
					<tr>
						<td>类型</td>
						<td colspan="3">
							<select class="easyui-combobox" name="type" data-options="editable:false,width:202">
								<option value="GENERAL">普通角色</option>
								<option value="SYSTEM">系统角色</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>描述：</td>
						<td colspan="3">
							<textarea class="easyui-textarea" rows="3" style="width: 90%;" name="descript"></textarea>
						</td>
					</tr>
					<tr>
						<td>是否启用：</td>
						<td colspan="3">
							<label>启用</label>
							<input type="radio" name="enabled" value="0" checked="checked"/>
							<label>不启用</label>
							<input type="radio" name="enabled" value="1"/>
						</td>
					</tr>
				</table>
				</form>
			</div>
			<div data-options="region:'south',border:false">
				<div class="dialog-button">
					<a id="ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="oRoleAdd.ok()">确定</a>
					<a id="cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="oRoleAdd.cancel()">取消</a>
				</div>
			</div>
		</div>
  </body>
</html>
